package com;

import com.feign.UserFeign;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;

/**
 * @author zhangyan
 * @version $ Id: ProviderApplication.java, v 0.1 2021/6/11 16:13 zhangyan Exp $
 */
@SpringBootApplication
@EnableFeignClients
public class CustomerApplication {
    public static void main(String[] args) {
        SpringApplication.run(CustomerApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

    @Resource
    private ApplicationContext applicationContext;


    @PostConstruct
    public void test1(){
        Map<String, UserFeign> beansOfType = applicationContext.getBeansOfType(UserFeign.class);
        System.out.println("88888888888888888888888888888");
        System.out.println(beansOfType);

    }

}
